package com.dykj.fireFighting.server.base.bigdata.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.dykj.fireFighting.api.base.bigdata.Building.entity.Building;
import com.dykj.fireFighting.api.base.bigdata.Building.service.IBuildingService;
import com.dykj.fireFighting.api.base.enterprise.entity.Enterprise;
import com.dykj.fireFighting.api.base.enterprise.service.IEnterpriseService;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.common.core.vo.TreeVo;
import com.dykj.fireFighting.server.base.bigdata.mapper.BuildingMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 建筑管理-楼栋管理
 *
 * @Author aixiaolan
 * @Date 2021-06-22 16:04:02
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Building> implements IBuildingService {
    @Autowired
    private IEnterpriseService iEnterpriseService;
    @Override
    public List<Building> getBuildList(String unitId) {
        Map<String, Object> params = new HashMap<String, Object>();
        if (StringUtils.isNotBlank(unitId)) {
            List<Enterprise> enterpriseList = iEnterpriseService.queryUnitSelect(unitId);
            if (CollectionUtil.isNotEmpty(enterpriseList)) {
                params.put("enterpriseList", enterpriseList);
            }
        }
        return this.baseMapper.selectByMapList(params);
    }
}
